package com.czxy.demo01;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
@Aspect
public class UserAspect01 {





    @Pointcut("execution(public  void com.czxy.demo01.User.sleep())")
    public  void  cp01(){



    }




    @Around("execution(public  void com.czxy.demo01.User.sleep())")

    public  void  arSleep(ProceedingJoinPoint pjp) throws Throwable {

        System.out.println("关掉");
        pjp.proceed();
        System.out.println("开始了");


    }


    @Before("cp01()")
    public  void  bfEat(JoinPoint jp){
        System.out.println("洗手 getSignature="+jp.getSignature()+" getArgs="+ Arrays.toString(jp.getArgs()) );
    }









}
